package cn.myfirefly.core.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class Permission implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -143787849717406648L;
	
	private String funId;
	
	private List<String> actions = new ArrayList<String>();
	
	private List<Map<String, String>> cols;

	private DataAuth dataAuth;
	
	public String getFunId() {
		return funId;
	}

	public void setFunId(String funId) {
		this.funId = funId;
	}

	public List<String> getActions() {
		return actions;
	}

	public void setActions(List<String> actions) {
		this.actions = actions;
	}

	public List<Map<String, String>> getCols() {
		return cols;
	}

	public void setCols(List<Map<String, String>> cols) {
		this.cols = cols;
	}
	
	public boolean isPermit(String action) {
		if (actions != null) {
			if (actions.indexOf(action) >= 0) {
				return true;
			}
		}
		return false;
	}
	
	public void addAction(String action) {
		actions.add(action);
	}

	public DataAuth getDataAuth() {
		return dataAuth;
	}

	public void setDataAuth(DataAuth dataAuth) {
		this.dataAuth = dataAuth;
	}
}
